package com.bzy.blade_gaetway.filter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 定义一个全局的过滤器;
 */
@Component
public class OveralFilter implements GlobalFilter, Ordered {


    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        HttpServletResponse response = (HttpServletResponse) exchange.getResponse();
        HttpServletRequest request = (HttpServletRequest)exchange.getRequest();
        String token = request.getHeader("token");

        return null;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}



















